﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel; 

namespace InscriberControlClient
{
    /// <summary>
    /// Interaction logic for Window3.xaml
    /// 
    /// 
    /// </summary>
    /// 
    
    public partial class Window3 : Window
    {
        public ObservableCollection<Titrai> tr;
        public static bool isMove = false;

        public Window3()
        {
            InitializeComponent();
           /* tr = new ObservableCollection<Titrai>() {
                new Titrai() { nr=1, Title = "Tim"},
                new Titrai() { nr=2, Title = "Marc" },
                new Titrai() { nr=3, Title = "Ann" },
                new Titrai() { nr=4, Title = "Jan" },
                new Titrai() { nr=5, Title="ddd" },
                new Titrai() { nr=6, Title = "Marc" },
                new Titrai() { nr=7, Title = "Ann" },
                new Titrai() { nr=8, Title = "Jan" },
                new Titrai() { nr=9, Title="ddd" },
                new Titrai() { nr=10, Title = "Marc" },
                new Titrai() { nr=11, Title = "Ann" },
                new Titrai() { nr=12, Title = "Jan" },
                new Titrai() { nr=13, Title="ddd" }
            };*/

            //peopleListBox.DataContext = tr;
        }

        private void Button_Click1(object sender, RoutedEventArgs e)
        {
            tr = Functionality.getTitrai("");
            peopleListBox.DataContext = tr;
        }

        private void Button_Click2(object sender, RoutedEventArgs e)
        {
            this.Hide();
        }

        private void cmdRunLD_Clicked(object sender, RoutedEventArgs e)
        {
              Button cmd = (Button)sender;
            if (cmd.DataContext is Titrai)
            {

                Titrai item = (Titrai)cmd.DataContext;
                //MessageBox.Show(item.nr.ToString());
                Functionality.startTR(item.nr.ToString());
               // tr.Remove(deleteme);

            }

        }

        private void cmdStopLD_Clicked(object sender, RoutedEventArgs e)
        {

            Button cmd = (Button)sender;
            if (cmd.DataContext is Titrai)
            {

                Titrai item = (Titrai)cmd.DataContext;
               // MessageBox.Show(item.nr.ToString());
                Functionality.stopTR();
                //tr.Remove(deleteme);

            }

        }

        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
        }

        private void peopleListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
           /* isMove = true;
            Functionality.lastPosition = Mouse.GetPosition(this);*/
        }

        private void Window_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            isMove = false;
        }

        private void Window_MouseMove(object sender, MouseEventArgs e)
        {
          /*  if (isMove)
            {
                System.Windows.Point pt = Mouse.GetPosition(this);
                Functionality.DragMoveNew(this, e, pt);
            }*/
        }

        private void Window_MouseLeave(object sender, MouseEventArgs e)
        {
            isMove = false;
        }

        
    }
}
